|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.ObjectSeat
public class Seat
Seat models a seat in a car in a passenger train.
| Constructor Summary | |
|---|---|
Seat(int seatNo,
double cost)
Constructs a new Seat with the specified seat number and ticket price. |
|
| Method Summary | |
|---|---|
boolean |
book()
If this seat is available, books it and returns true. |
boolean |
cancelBooking()
If this seat is booked, cancels the booking and returns true. |
boolean |
isBooked()
Returns true if someone has purchased a ticket for this this Seat. |
int |
number()
Returns this seat's number. |
double |
price()
Returns the cost of purchasing a ticket for this Seat. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Seat(int seatNo,
double cost)
seatNo - The number of the seat.cost - The cost of a ticket for this seat, in dollars.| Method Detail |
|---|
public boolean book()
public boolean cancelBooking()
public boolean isBooked()
public int number()
public double price()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||